def PrintFib(n):  # 定义函数PrintFib，输出斐波那契数列的前n项
    a, b = 1, 1  # 等价于两个赋值语句，即a = 1和b = 1
    for i in range(1, n+1):  # i的取值依次为1,2,…,n
        print(a, end=' ')  # 输出斐波那契数列的第i项
        a, b = b, a+b  # 更新斐波那契数列第i+1项的值，并计算第i+2项的值
    print()  # 输出一个换行


def Fib(n):  # 定义前两项分别是：0,1；n>=1
    result = []
    a, b = 0, 1
    for i in range(n):
        result.append(a)
        #a, b = b, a+b
        temp = a
        a = b
        b = temp + b
    return result

def sumFib(n):
    fibN = Fib(n)
    sum = 0
    for i in range(n):
        sum += fibN[i]
    return sum

print(__name__)

if __name__ == '__main__':
    PrintFib(10)
    print(Fib(10))
    print(sumFib(10))
